#include <bits/stdc++.h>
#include <string>
using namespace std;

struct option
{
    double w;
    int c;
};

struct option items[31];

bool cmp(struct option a, struct option b)
{
    return (double)(a.c / a.w) > (double)(b.c / b.w);
}

int main()
{
    int m, n;
    cin >> m >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> items[i].w >> items[i].c;
    }
    sort(items, items + n, cmp);
    double k = m, maxPrice = 0;
    for (int i = 0; i < n; i++)
    {
        double useWight = min(items[i].w, k);
        maxPrice += useWight*(items[i].c/items[i].w);
        k-= useWight;
        if(k==0) break;
    }
    cout << maxPrice;
    return 0;
}